<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>地点列表</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<!-- Add by Kravis Liu 2014.09.22 -->
		<link rel="stylesheet" href="/css/base.css" />
		<link rel="stylesheet" href="/css/list2.css" />
		<script src="/js/jquery-1.11.1.min.js"></script>
		<script type="text/javascript">
			function deleteLocation(locationId){
				if(confirm("是否确定删除地点？")){
					$.ajax({
					   type: "POST",
					   url: "/app/deleteLocation",
					   data: "locationId=" + locationId,
					   success: function(msg){
						 if(msg == "success"){
							 alert("操作成功！");
							 $("#"+locationId).hide();			 
						 } else {
							alert("操作失败！");
						 }
					   }
					});					
				}
			}
		</script>
	</head>
	<body>
		<div id="page">
			<div id="header">
				<h4>地点列表</h4>
			</div>

			<table width="98%" align="center" border="1" cellpadding="0" cellspacing="0">
				<tbody id="add_point">
					<tr>
						<td><div align="center">地点名</div></td>
						<td><div align="center">发布者</div></td>
						<td><div align="center">截至时间</div></td>
						<td><div align="center">操作</div></td>
					</tr>
					
					<% if (Locations){ %>
					<%  
						Locations.forEach(function (tmpLocation){ 
					%>	
					<tr id="<%= tmpLocation.id%>">
						<td><div align="center"><a href="/app/openLocation?locationId=<%= tmpLocation.id %>" ><%= tmpLocation.get('locationName') %></a></div></td>
						
						<td><div align="center"><%= tmpLocation.get('creater').get('username') %></div></td>
						<td><div align="center"><%= tmpLocation.get('endTime') %></div></td>
						<td><div align="center"><a href="javascript:void(0)" onClick="deleteLocation('<%= tmpLocation.id%>');">删除</a></div></td>
					</tr>
					<% })} %>  
				</tbody>
			</table>
			<p>&nbsp;</p>
			
			<div id="footer">
				<a style="float:right;margin:5px" href="/logout">退出</a>
				<a style="float:right;margin:5px" href="/app/index">主页</a>
				<% if(next != 0){ %>
					<a style="float:right;margin:5px" href="/app/locationList?page=<%=next%>">下一页</a>
				<%}%>					
				<% if(previous >= 0){ %>
					<a style="float:right;margin:5px" href="/app/locationList?page=<%=previous%>">上一页</a>
				<%}%>				
			</div>
		</div>
	</body>
</html>
